package edu.xmut.yuepaibackend.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import edu.xmut.yuepaibackend.model.domain.Comment;
import edu.xmut.yuepaibackend.service.CommentService;
import edu.xmut.yuepaibackend.mapper.CommentMapper;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author tanjiao
 * @description 针对表【comment(评论)】的数据库操作Service实现
 * @createDate 2024-09-05 16:53:50
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment>
        implements CommentService {


    @Override
    public List<Comment> getCommentByBlogId(Long id) {
        LambdaQueryWrapper<Comment> lq = new LambdaQueryWrapper<>();
        lq.eq(Comment::getBlogId, id).eq(Comment::getIsDeleted, 0);
        ArrayList<Comment> commentList = new ArrayList<>();
        commentList.addAll(this.list(lq));
        return commentList;
    }

}




